# -*- coding:utf-8 -*-
import memcache

class Singleton(object):
    def __new__(cls,*args,**kw):
        if not hasattr(cls,"_instance"):
            orig = super(Singleton,cls)
            cls._instance = orig.__new__(cls,*args,**kw)
        return cls._instance  

class memcacheDao(Singleton):
    def __init__(self):
        mcconfig = {}
        mcconfig['host'] = '127.0.0.1'
        mcconfig['port'] = 11211
        mc_list = []
        mc_list.append('%s:%u' % (mcconfig['host'], mcconfig['port'],))
        self.__mc = memcache.Client(mc_list, debug=0)
    def getInstance(self):
        return self.__mc
